home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_HDF.idb / usr / freeware / include / hdf / cnbit.h.z / cnbit.h
Encoding:
C/C++ Source or Header  |  1999-01-26  |  4.2 KB  |  112 lines

  1. /****************************************************************************
  2.  * NCSA HDF                                                                 *
  3.  * Software Development Group                                               *
  4.  * National Center for Supercomputing Applications                          *
  5.  * University of Illinois at Urbana-Champaign                               *
  6.  * 605 E. Springfield, Champaign IL 61820                                   *
  7.  *                                                                          *
  8.  * For conditions of distribution and use, see the accompanying             *
  9.  * hdf/COPYING file.                                                        *
  10.  *                                                                          *
  11.  ****************************************************************************/
  12.  
  13.  /* $Id: cnbit.h,v 1.16 1997/10/24 21:00:20 koziol Exp $ */
  14.  
  15.  /*-----------------------------------------------------------------------------
  16.  * File:    cnbit.h
  17.  * Purpose: Header file for N-bit encoding information.
  18.  * Dependencies: should only be included from hcompi.h
  19.  * Invokes: none
  20.  * Contents: Structures & definitions for N-bit encoding.
  21.  * Structure definitions:
  22.  * Constant definitions:
  23.  *---------------------------------------------------------------------------*/
  24.  
  25. /* avoid re-inclusion */
  26. #ifndef __CNBIT_H
  27. #define __CNBIT_H
  28.  
  29. #if defined c_plusplus || defined __cplusplus
  30. extern      "C"
  31. {
  32. #endif                          /* c_plusplus || __cplusplus */
  33.  
  34. /*
  35.    ** from cnbit.c
  36.  */
  37.  
  38.     extern int32 HCPcnbit_stread
  39.                 (accrec_t * rec);
  40.  
  41.     extern int32 HCPcnbit_stwrite
  42.                 (accrec_t * rec);
  43.  
  44.     extern int32 HCPcnbit_seek
  45.                 (accrec_t * access_rec, int32 offset, int origin);
  46.  
  47.     extern int32 HCPcnbit_inquire
  48.                 (accrec_t * access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref,
  49.                int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
  50.                  int16 *pspecial);
  51.  
  52.     extern int32 HCPcnbit_read
  53.                 (accrec_t * access_rec, int32 length, void * data);
  54.  
  55.     extern int32 HCPcnbit_write
  56.                 (accrec_t * access_rec, int32 length, const void * data);
  57.  
  58.     extern intn HCPcnbit_endaccess
  59.                 (accrec_t * access_rec);
  60.  
  61. #if defined c_plusplus || defined __cplusplus
  62. }
  63. #endif                          /* c_plusplus || __cplusplus */
  64.  
  65. /* size of the N-bit buffer */
  66. #define NBIT_BUF_SIZE   (MAX_NT_SIZE*64)
  67. /* size of the N-bit mask buffer (same as buffer size for now) */
  68. #define NBIT_MASK_SIZE  (MAX_NT_SIZE)
  69.  
  70. typedef struct
  71. {                               /* structure to hold bit vector info */
  72.     intn        offset,         /* offset of the bit information */
  73.                 length;         /* number of bits in the information */
  74.     uint8       mask;           /* mask for this bit vector */
  75. }
  76. nbit_mask_info_t;
  77.  
  78. /* N-bit [en|de]coding information */
  79. typedef struct
  80.   {
  81.       int32       nt;           /* number type of data we are encoding */
  82.       intn        nt_size;      /* size of the number-type in the file */
  83.       intn        fill_one;     /* whether to fill with 1's or not (0's) */
  84.       intn        sign_ext;     /* whether to sign extend or not */
  85.       uint8       buffer[NBIT_BUF_SIZE];    /* buffer for expanding n-bit data in */
  86.       intn        buf_pos;      /* current offset in the expansion buffer */
  87.       intn        mask_off,     /* offset of the bit to start masking with */
  88.                   mask_len;     /* number of bits to mask */
  89.       int32       offset;       /* offset in the file in terms of bytes */
  90.       uint8       mask_buf[NBIT_MASK_SIZE];     /* buffer to hold the bitmask */
  91.       nbit_mask_info_t mask_info[NBIT_MASK_SIZE];   /* information about the mask */
  92.       intn        nt_pos;       /* current byte to read or write */
  93.   }
  94. comp_coder_nbit_info_t;
  95.  
  96. #ifndef CNBIT_MASTER
  97. extern funclist_t cnbit_funcs;  /* functions to perform N-bit encoding */
  98. #else
  99. funclist_t  cnbit_funcs =
  100. {                               /* functions to perform N-bit encoding */
  101.     HCPcnbit_stread,
  102.     HCPcnbit_stwrite,
  103.     HCPcnbit_seek,
  104.     HCPcnbit_inquire,
  105.     HCPcnbit_read,
  106.     HCPcnbit_write,
  107.     HCPcnbit_endaccess
  108. };
  109. #endif
  110.  
  111. #endif /* __CNBIT_H */
  112.